<me:UIAPFOLGE x:Class="WPFExcelReport.TAP02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                     xmlns:LS="clr-namespace:WPFExcelReport;assembly=TLIEFDAT"   
                     xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:KS="clr-namespace:WPFExcelReport;assembly=TKSTSTELL" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    xmlns:OP="clr-namespace:WPFExcelReport;assembly=TKSTAGZUO"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIAPFOLGE.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:SDKEYCONV x:Key="sd"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAPFOLGE.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="1" >
            <StackPanel  >
              
                <WrapPanel>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top" IsEnabled="{Binding IsCanChg,ElementName=TV}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button  Click="EditCommand" Width="24" Height="20">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                      IsEnabled="{Binding IsCanDelete,ElementName=TV}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                            </Button.Background>
                        </Button>
                    </Grid>

                    <Grid Margin="10,0,0,0" VerticalAlignment="Top"  
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <WrapPanel Visibility="Collapsed">
                        <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=流程}}"/>
                            <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2"   IsAutoClear="True" 
                              CharacterCasing="Upper" Text="{Binding KRS,ElementName=TV}" Width="30" />
                            <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="4"  IsAutoClear="True" 
                              Text="{Binding LFD,ElementName=TV}" KeyUp="Query_KeyUp" Width="90" />
                        </Grid>
                        <Grid Margin="10,0,0,0"  VerticalAlignment="Top"   >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=查询}}"/>
                        </Grid>
                    </WrapPanel>
                    <WrapPanel> 
                        <WrapPanel >
                            <TextBlock Grid.Column="1" FontSize="16"  
                                       Text="{Binding KRS,ElementName=TV}" Width="30" />
                            <TextBlock Grid.Column="2" FontSize="16" Margin="5,0,0,0"  
                                      Text="{Binding LFD,ElementName=TV}"   Width="90" />
                            <ex:TXT72  MaxLength="3" PRE="000" Width="60" Background="LightYellow"
                                      Text="{Binding POS,ElementName=TV}"  />
                            <Grid Margin="10,0,0,0"  VerticalAlignment="Top" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                    <Button.Background>
                                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                                    </Button.Background>
                                </Button>
                            </Grid>
                        </WrapPanel>
                    </WrapPanel>
                </WrapPanel>
            </StackPanel>
            <WrapPanel>
                <KS:TSKS03 Name="cKS03"
                    KST="{Binding KST,ElementName=TV}"
                    KSTKRS="{Binding KSTKRS,ElementName=TV}" 
                    IsEdit="{Binding IsEdit,ElementName=TV}"
                    />
                <OP:TSKS05 EXAUF="{Binding KEY,ElementName=cKS03}"
                     KEY="{Binding AGANG,ElementName=TV}"
                     ORDERNUM="{Binding AGANG,ElementName=TV}"
                     IsEdit="{Binding IsEdit,ElementName=TV}"
                    />
                <ex:TXT72 MaxLength="60" Text="{Binding APFBZAGANG,Converter={StaticResource gb2312}}" Width="200"/>
            </WrapPanel>
            <WrapPanel>
                <CheckBox Margin="10,0,0,0" IsChecked="{Binding IsFinish,ElementName=TV}" 
                          Content="{Binding Source={Localization:Translate Word=转成品}}" />
                <SD:K8876 Margin="10,0,0,0"
                         KEY="{Binding APFRUECKKZ,ElementName=TV}" 
                          ORDERNUM="{Binding APFRUECKKZ,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K8875 Margin="10,0,0,0"
                    KEY="{Binding APFKENNUNG,ElementName=TV}" 
                          ORDERNUM="{Binding APFKENNUNG,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K8874 Margin="10,0,0,0"
                    KEY="{Binding APFMATABR,ElementName=TV}" 
                          ORDERNUM="{Binding APFMATABR,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K0252 Margin="10,0,0,0"
                    KEY="{Binding APFZUSTAND,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSTAND,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
            </WrapPanel>
            <WrapPanel>
                <SD:K9321 Margin="10,0,0,0"
                    KEY="{Binding APFZUSATZ1,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSATZ1,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K9321 Margin="10,0,0,0"
                    KEY="{Binding APFZUSATZ2,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSATZ2,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K9321 Margin="10,0,0,0"
                    KEY="{Binding APFZUSATZ3,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSATZ3,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K9321 Margin="10,0,0,0"
                    KEY="{Binding APFZUSATZ4,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSATZ4,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
                <SD:K9321 Margin="10,0,0,0"
                    KEY="{Binding APFZUSATZ5,ElementName=TV}" 
                          ORDERNUM="{Binding APFZUSATZ5,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"
                          />
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  Grid.Column="1"  
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding APFAFOLGE}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding APFKSTKRS}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding APFKST}" Header="{Binding Source={Localization:Translate Word=成本中心}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding APFAGANG}" Header="{Binding Source={Localization:Translate Word=操做}}" Width="60"/>
                <DataGridTextColumn Binding="{Binding APFAGANG,Converter={StaticResource sd},ConverterParameter=0231}" Header="{Binding Source={Localization:Translate Word=说明}}" Width="60"/>
                <DataGridTextColumn  Binding="{Binding APFBZAGANG,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=步骤说明}}" Width="60"/>
                <DataGridTextColumn  Binding="{Binding APFZUSATZ1}" Header="{Binding Source={Localization:Translate Word=产出1}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APFZUSATZ2}" Header="{Binding Source={Localization:Translate Word=产出2}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APFZUSATZ3}" Header="{Binding Source={Localization:Translate Word=产出3}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APFZUSATZ4}" Header="{Binding Source={Localization:Translate Word=产出4}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APFZUSATZ5}" Header="{Binding Source={Localization:Translate Word=产出5}}" Width="Auto"/>
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIAPFOLGE>
